package com.ganmiao.enums;


import lombok.Getter;

@Getter
public enum LoginClientEnum {
    //"授权客户端：1 小程序；2 h5；3 app",
    LOGIN_CLIENT_MP(1, "小程序"),
    LOGIN_CLIENT_H5(2, "h5"),
    LOGIN_CLIENT_APP(3, "app"),
    ;

    private final Integer code;
    private final String desc;

    LoginClientEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    // 根据code获取枚举实例
    public static LoginClientEnum getByCode(Integer code) {
        for (LoginClientEnum type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Invalid LoginClient: code= " + code);
    }
}
